<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="Mosaddek">
    <meta name="keyword" content="FlatLab, Dashboard, Bootstrap, Admin, Template, Theme, Responsive, Fluid, Retina">
    <link rel="shortcut icon" href="__PUBLIC__/img/favicon.png">

    <title>南牧物联网云平台</title>

    <!-- Bootstrap core CSS -->
    <link href="__PUBLIC__/css/bootstrap.min.css" rel="stylesheet">
    <link href="__PUBLIC__/css/bootstrap-reset.css" rel="stylesheet">
    <!--external css-->
    <link href="__PUBLIC__/assets/font-awesome/css/font-awesome.css" rel="stylesheet" />
	<link href="__PUBLIC__/assets/morris.js-0.4.3/morris.css" rel="stylesheet" />
    <link href="__PUBLIC__/assets/jquery-easy-pie-chart/jquery.easy-pie-chart.css" rel="stylesheet" type="text/css" media="screen"/>
    <link rel="stylesheet" href="__PUBLIC__/css/owl.carousel.css" type="text/css">

      <!--right slidebar-->
      <link href="__PUBLIC__/css/slidebars.css" rel="stylesheet">

    <!-- Custom styles for this template -->

    <link href="__PUBLIC__/css/style.css" rel="stylesheet">
    <link href="__PUBLIC__/css/style-responsive.css" rel="stylesheet" />
  </head>

  <body>
	    <section id="container" >

		    <include file="./Index/head"/>
		    <section id="main-content">
			    <section class="wrapper">
				  <div class="row">
						<div class="col-lg-2">
						  <section class="panel">
							  <!-- <header class="panel-heading ">
								  栏舍
							  </header> -->
							  <div class="list-group">
								<foreach name="houselist" item="vo" key="k">
								  <a class="list-group-item" id="id-house-{$vo.rid}" href="javascript:;" onclick="loadDevice('{$vo.rid}')"><i class="fa fa-th"></i>  {$vo.housename}</a>
								</foreach>
							  </div>
						  </section>
					  </div>
					  <div class="col-lg-10">
						  <section class="panel">
							  <header class="panel-heading">
								  设备管理
									<span class="pull-right">
									  <!-- <button type="button" id="loading-btn" class="btn btn-info btn-xs"><i class="fa fa-plus"></i> 增加</button> -->
									  <a href="#myModal" data-toggle="modal" class=" btn btn-info btn-xs"> <i class="fa fa-plus"></i>增加</a>
								  </span>
							  </header>
							  
							  <div class="panel-body">
								  <div class="row">

									  <div class="col-lg-6 col-md-12">
										  <div class="input-group"><input type="text" placeholder="Search Here" class="input-sm form-control"> <span class="input-group-btn">
										  <button type="button" class="btn btn-sm btn-info"> 搜索!</button> </span></div>
									  </div>
									  

								  </div>
							  </div>
						  
							  <table class="table table-advance table-hover">
								  <thead>
								  <tr>
									  <th>设备</th>
									  <th>操作</th>
								  </tr>
								  </thead>
								  <tbody id='id-table-body'>

								  <!-- <tr>
									  <td><a  href="#">料线控制器1</a></td>
									  <td>
										  <a  href="{:u('Setting/nm3000')}"><span class="label label-success"><i class="fa fa-gear"> 设置料线控制</i></span></a>
									  </td>
								  </tr> -->
								  
								  </tbody>
							  </table>
						  

						  </section>
					  </div>
				  </div>
			    </section>
		    </section>
	    </section>

    <!-- js placed at the end of the document so the pages load faster -->
    <script src="__PUBLIC__/js/jquery.js"></script>
    <script src="__PUBLIC__/js/bootstrap.min.js"></script>
    <script class="include" type="text/javascript" src="__PUBLIC__/js/jquery.dcjqaccordion.2.7.js"></script>
    <script src="__PUBLIC__/js/jquery.scrollTo.min.js"></script>
    <script src="__PUBLIC__/js/jquery.nicescroll.js" type="text/javascript"></script>
    <script src="__PUBLIC__/js/jquery.sparkline.js" type="text/javascript"></script>
    <script src="__PUBLIC__/assets/jquery-easy-pie-chart/jquery.easy-pie-chart.js"></script>
    <script src="__PUBLIC__/js/owl.carousel.js" ></script>
    <script src="__PUBLIC__/js/jquery.customSelect.min.js" ></script>
	<script src="__PUBLIC__/assets/morris.js-0.4.3/morris.min.js" type="text/javascript"></script>
    <script src="__PUBLIC__/assets/morris.js-0.4.3/raphael-min.js" type="text/javascript"></script>
    <script src="__PUBLIC__/js/respond.min.js" ></script>

    <!--right slidebar-->
    <script src="__PUBLIC__/js/slidebars.min.js"></script>
	
	<!--Form Validation-->
    <script src="__PUBLIC__/js/bootstrap-validator.min.js" type="text/javascript"></script>

    <!--Form Wizard-->
    <script src="__PUBLIC__/js/jquery.steps.min.js" type="text/javascript"></script>
    <script src="__PUBLIC__/js/jquery.validate.min.js" type="text/javascript"></script>

    <!--common script for all pages-->
    <script src="__PUBLIC__/js/common-scripts.js"></script>

	<!-- 引入 echarts.js -->
    <script src="__PUBLIC__/assets/echart/echarts.js"></script>
	<script src="__PUBLIC__/assets/echart/macarons.js"></script>
	<script src="__PUBLIC__/assets/echart/china.js"></script>
	
    <!--script for this page-->
    <script src="__PUBLIC__/js/sparkline-chart.js"></script>
    <script src="__PUBLIC__/js/easy-pie-chart.js"></script>
	<script src="__PUBLIC__/js/count.js"></script>
	<script src="__PUBLIC__/js/echart.js"></script>

	<!--script for this page-->
    <script src="__PUBLIC__/js/jquery.stepy.js"></script>
	<!-- layer -->
	<script src="__PUBLIC__/plugins/layer-v3.0.1/layer/layer.js"></script>

  <script>

	  var urlstatus='{:u('Status/index')}';
	  var url3000='{:u('Setting/nm3000')}';
	  var url800='{:u('Setting/bw800')}';
	  
      $(document).ready(function() {

      });

	  function loadDevice(rid){
		$('.list-group-item').each(function(){
			$(this).removeClass("active");
		});
		$('#id-house-'+rid).addClass("active");
		layer.load();
		$.ajax({
		  type: 'POST',
		  url: "{:u('Setting/loadDevice')}",
		  data: {rid:rid},
		  success: function(data){
			var htmlstr='';
			if(data.length>0){
				for(var i=0;i<data.length;i++){
					if(data[i].type==='nm3000'){
						htmlstr+="<tr><td><a  href='"+urlstatus+"?rid="+rid+"'>"+data[i].name+"</a></td><td><a  href='"+url3000+"?rid="+data[i].rid+"'><span class='label label-success'><i class='fa fa-gear'>设置料线控制</i></span></a></td></tr>";
					}
					else if(data[i].type==='bw800'){
						htmlstr+="<tr><td><a  href='"+urlstatus+"?rid="+rid+"'>"+data[i].name+"</a></td><td><a  href='"+url800+"?rid="+data[i].rid+"'><span class='label label-info'><i class='fa fa-gear'>设置母猪饲喂器</i></span></a></td></tr>";
					}
				}
			}
			$('#id-table-body').html(htmlstr);
			
		  },
		  error: function (data) {
			alert(data);
		  },
		  complete: function (XHR, TS) {
			layer.closeAll('loading');
		  },
		  dataType: "json"
		});
	  }

      $(function(){
			$('#default').stepy({
              backLabel: '返回',
              block: true,
              nextLabel: '下一步',
              titleClick: true,
              titleTarget: '.stepy-tab'
          });
      });

  </script>

  </body>
</html>
